<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix = "s" uri ="/struts-tags" %>
<%@ taglib uri="/struts-dojo-tags" prefix="sx"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'index.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	
	<sx:head parseContent="true"/>
	
		<script type="text/javascript" src="addSecondId/jquery-1.7.2.js"></script>
	<script type="text/javascript">
  		$(document).ready(function(){
  		
			init();
			$("#taxAllInfoList").click(function(){getZyClass();});
			$("#zyClassList").click(function(){getZyFirst();});	
			$("#zyFirstList").click(function(){getZySecond();});	
			$("#zySecondList").dblclick(function(){select();});	
			$("#fileSecondTag").dblclick(function(){deleteTag();});	
			
			
						
			
			
		});
		//总分类
		function init(){
			$("#taxAllInfo").empty();
			$.ajax({
				url:"taxAllInfo!showTaxAllInfoAdd",
				type:"POST",
				success:function(result,status){
					alert(status);
					var objs = eval("("+result+")");
					 $.each(objs,function(index,item){
					 		$("<option></option>")
								.val(item["infoId"])
								.text(item["infoName"])
								.appendTo($("#taxAllInfoList"));
					 });  
					
				}
			});
		};
		
		//分类
		function getZyClass(){
			$("#zyClassList").empty();
			$.ajax({
				url:"zyClass!showZyClassByPidAdd?pid="+$("#taxAllInfoList").val(),
				type:"POST",
				success:function(result,status){
					var objs = eval("("+result+")");				
					 $.each(objs,function(index,item){ 
					 		$("<option></option>")
								.val(item["classId"])
								.text(item["className"])
								.appendTo($("#zyClassList"));
					 });  					
				}
			});
		};
		
		//查询一级分类
		function getZyFirst(){			
			$("#zyFirstList").empty();
			
			$.ajax({
				url:"zyFirst!showZyFirstByPidAdd?pid="+$("#zyClassList").val(),
				type:"POST",
				success:function(result,status){
					var objs = eval("("+result+")");
					 $.each(objs,function(index,item){ 					
					 			$("<option></option>")
								.val(item["firstId"])
								.text(item["firstName"])
								.appendTo($("#zyFirstList"));
					 }); 
					 
					  					
				}
			});
		};
		
		//查询二级分类
		function getZySecond(){
			$("#zySecondList").empty();
			//$("#fileAllInfoTage").val($("#zyFirstList").val());//设置隐藏的firstId值
			$.ajax({
				url:"zySecond!showZySecondByPidAdd?firstId="+$("#zyFirstList").val(),
				type:"POST",
				success:function(result,status){
					var objs = eval("("+result+")");
						 $.each(objs,function(index,item){      
					 		$("<option></option>")
								.val(item["secondId"])
								.text(item["secondName"])
								.appendTo($("#zySecondList"));
				/*			$("<input type='checkbox' name='fileSecondTag' id='fileSecondTag'></input>")
								.val(item["secondId"])
								.appendTo($("#secondList"));
							$("<label for='zySecond'></label>")
								.html(item["secondName"])
								.appendTo($("#secondList"));
							if(index%5==0){
								$("#secondList").append("<br/>");
							}
				*/			
					 });  					
				}
			});
		};
	
		function s(){
			alert("s");
		}
		function select(){
			$("<option selected='selected'></option>")
				.val($("#zySecondList option:selected").val())
				.text($("#zyFirstList option:selected").text()+"->"+$("#zySecondList option:selected").text())
				.appendTo($("#fileSecondTag"));	
			$("<option selected='selected'></option>")
				.val($("#zyFirstList option:selected").val())
				.appendTo($("#fileFirstTag"));
				
			
		}
		
		function deleteTag(){
			this.selected='';
		}
	
		/* function setFirstId(){//设置隐藏的FirstId
			$("fileAllInfoTage").val($("#zyFirstList"));
		} */
</script>	
  </head>
  
  <body>

文件信息编辑
<form method="post" action="taxFile!updateTaxFile">
<hr/>
  文件分类：<br>
  分类人员ID:<input type="text" name="fileSorterId"/><br>
<table>
      <tr>
      		<th>总信息</th>
			<th>总分类</th>
			<th>一级</th>
			<th>二级</th>
			<th>文章分类</th>
			<th></th>
      </tr>	      
    
  
	
 		<tr>
          <td>
              <select id="taxAllInfoList"  multiple="true" size="8" style="width:110px;" ></select>
          </td>
          <td>
              <select id="zyClassList" multiple="true" size="8" style="width:110px;"></select>
          </td>
          <td>
              <select id="zyFirstList" multiple="true" size="8"  style="width:110px;"></select>
          </td>
          <td>
              <select id="zySecondList" multiple="true" size="8" style="width:150px;"></select>
          </td>
          <td>
              <select id="fileSecondTag" name="fileSecondTag" multiple="true" size="8" style="width:200px;"></select>
          	   
          </td>
          <td>
           <select id="fileFirstTag" name="fileFirstTag"  multiple="true" size="8" style="width:200px;visibility:hidden;"></select>
         </td>
      </tr>
      <tr>
      <td>
      	<input type="submit"/>
      <td>
      </tr>
   </table>
  <hr>

   <s:set name="taxFile" value="#request.file"/>
<table>
		
 		<tr>
 			<td>ID:<s:property value="#taxFile.fileId"/></td>
 			<s:hidden name="fileId" value="%{#taxFile.fileId}"></s:hidden>
 		</tr>
 		<tr>
 			<td>标题*：<s:textfield value="%{#taxFile.fileTitle}" theme="simple" name="fileTitle"/></td>
 		</tr>
 		<tr>
 			<td>文件号：<s:textfield value="%{#taxFile.fileNo}" theme="simple" name="fileNo"/></td>
 		</tr>
 		<tr>
 			<td>发布时间*：<sx:datetimepicker value="#taxFile.fileDate"  name="fileDate" ></sx:datetimepicker></td>
 		</tr>
 		<tr>
 			<td>总分类标签：<s:textfield disabled  ="true" value="%{#taxFile.fileAllInfoTage}" theme="simple" /></td>
 		</tr>
 		<tr>
 			<td>二级分类标签*：<s:textfield disabled  ="true" value="%{#taxFile.fileSecondTag}" theme="simple" /></td>
 		</tr>
 		<tr>
 			<td>内容*：<br><s:textarea value="%{#taxFile.fileContent}" cols="80" rows="10" theme="simple" name="fileContent"/></td>
 		</tr>
 		<tr>
 			<td>状态*：<s:radio value="%{#taxFile.fileStatus}" theme="simple" list="{'有效法规','失效法规','部分失效','全文过时','基本法规'}" name="fileStatus"/></td>
 		</tr>
 		<tr>
 			<td>备注：<s:textfield value="%{#taxFile.fileInfo}" theme="simple" name="fileInfo"/></td>
 		</tr>
 		<tr>
 			<td>参考文件：<s:textfield value="%{#taxFile.fileReference}" theme="simple" name="fileReference"/></td>
 		</tr>
 		<tr>
 			<td><input type="submit" value="确认修改"/>
 		</tr>
    	
    </table>
   </form>
  </body>
</html>
